"""
2.键盘操作.py
from selenium.webdriver import Keys
send_keys()

"""
from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver import Keys
driver = webdriver.Chrome()
# sleep(2)
# driver.minimize_window()
sleep(2)
driver.maximize_window()
sleep(2)
driver.get("http://www.baidu.com")
sleep(2)
t = driver.find_element(By.ID,"kw")
# #动作链表示可以连续执行的动作,每个动作用 '.'进行连接,最后使用perform()进行结尾
t.send_keys("hello")
sleep(2)
t.send_keys(Keys.CONTROL,"a")
sleep(2)
t.send_keys(Keys.CONTROL,"x")
sleep(2)
t.send_keys(Keys.CONTROL,"v"*3)
sleep(2)
t.send_keys(Keys.BACKSPACE*7)
sleep(2)

driver.quit()